public class J05jiecheng {
    public static void main(String[] args) {
        //求10的阶乘
        //1*2...*10
        int result = 1;

        int num = 15;
        for (int i = 1; i <= num; i++) {
            //1*1*2*3*。。。。*9*10
            result = result * i;
        }
        System.out.println("result = " + result);
    }
}

class Jiecheng2{
    public static void main(String[] args) {
        //求1! + 2! + 3! + 4!的和是多少。
        int num = 4;

        //储存和
        int sum = 0;
        for (int i = 1; i <= 4; i++) {
            //i
            //求i的阶乘
            int result = 1;
            for (int j = 1; j <= i; j++) {
                result *= j;
            }
            sum += result;
        }
        System.out.println("sum = " + sum);
    }
}
